package com.mzx.javase.io;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * 类描述：BufferedReader测试类
 *
 * @ClassName BufferedReaderTest
 * @Description TODO
 * @Author 马子鑫
 * @Date 2022/7/31 15:53
 * @Version 1.0
 */
public class BufferedReaderTest {
    public static void main(String[] args) {
        BufferedReader br = null;
        try {
            br = new BufferedReader(new FileReader("temp"));
            String readLine = null;
            while ((readLine = br.readLine()) != null) {
                System.out.println(readLine);
            }
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
}
